package com.novax.ex.activity.provider.common;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @description:
 * @author: Wade
 * @date: 10/24/24 2:56 PM
 * @param:
 * @return:
 **/
public class Binlog {
    private long id;
    private String database;
    private String table;
    private List<String> pkNames;
    private Boolean isDdl;
    private String type;
    // binlog executeTime
    private Long es;
    // dml build timeStamp
    private Long ts;
    private String sql;
    private LinkedHashMap<String, Integer> sqlType;
    private LinkedHashMap<String, String> mysqlType;
    private List<LinkedHashMap<String, String>> data;
    private List<LinkedHashMap<String, String>> old;

    public Binlog() {
    }

    public Binlog(long id) {
        this.id = id;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getDatabase() {
        return database;
    }

    public void setDatabase(String database) {
        this.database = database;
    }

    public String getTable() {
        return table;
    }

    public void setTable(String table) {
        this.table = table;
    }

    public List<String> getPkNames() {
        return pkNames;
    }

    public void addPkName(String pkName) {
        if (this.pkNames == null) {
            this.pkNames = new ArrayList<>();
        }
        this.pkNames.add(pkName);
    }

    public void setPkNames(List<String> pkNames) {
        this.pkNames = pkNames;
    }

    public Boolean getIsDdl() {
        return isDdl;
    }

    public void setIsDdl(Boolean isDdl) {
        this.isDdl = isDdl;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Long getTs() {
        return ts;
    }

    public void setTs(Long ts) {
        this.ts = ts;
    }

    public String getSql() {
        return sql;
    }

    public void setSql(String sql) {
        this.sql = sql;
    }

    public Map<String, Integer> getSqlType() {
        return sqlType;
    }

    public void setSqlType(LinkedHashMap<String, Integer> sqlType) {
        this.sqlType = sqlType;
    }

    public Map<String, String> getMysqlType() {
        return mysqlType;
    }

    public void setMysqlType(LinkedHashMap<String, String> mysqlType) {
        this.mysqlType = mysqlType;
    }

    public List<LinkedHashMap<String, String>> getData() {
        return data;
    }

    public void setData(List<LinkedHashMap<String, String>> data) {
        this.data = data;
    }

    public List<LinkedHashMap<String, String>> getOld() {
        return old;
    }

    public void setOld(List<LinkedHashMap<String, String>> old) {
        this.old = old;
    }

    public Long getEs() {
        return es;
    }

    public void setEs(Long es) {
        this.es = es;
    }

    @Override
    public String toString() {
        return "Binlog{" +
                "id=" + id +
                ", database='" + database + '\'' +
                ", table='" + table + '\'' +
                ", pkNames=" + pkNames +
                ", isDdl=" + isDdl +
                ", type='" + type + '\'' +
                ", es=" + es +
                ", ts=" + ts +
                ", sql='" + sql + '\'' +
                ", sqlType=" + sqlType +
                ", mysqlType=" + mysqlType +
                ", data=" + data +
                ", old=" + old +
                '}';
    }
}
